﻿using System;
using Locator.Silverlight.Client.Models.PersonalLocationsServiceReference;
using Locator.Silverlight.Client.Models.ViewModels.Elements;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Locator.Silverlight.Client.Test
{
    public class MockPersonalLocationService : IPersonalLocationsServiceAsync
    {
        /// <summary>
        /// Initializes a new instance of the MockPersonalLocationService class.
        /// </summary>
        public MockPersonalLocationService()
        {
            this.GetPersonalLocationsResult = new ObservableCollection<PersonalLocation>();
        }

        public ObservableCollection<PersonalLocation> GetPersonalLocationsResult { get; private set; }

        public PersonalLocationViewModel GetPersonalLocationResult { get; set; }

        public void AddPersonalLocationForCurrentUserAsync(string description, double latitude, double longitude)
        {
            this.GetPersonalLocationsResult.Add(new PersonalLocation() { Description = description, Id = this.GetPersonalLocationsResult.Count, Latitude = (decimal)latitude, Longitude = (decimal)longitude });
            if (this.AddPersonalLocationForCurrentUserCompleted != null)
            {
                this.AddPersonalLocationForCurrentUserCompleted(null, new AsyncCompletedEventArgs(null, false, null));
            }
        }

        public event EventHandler<AsyncCompletedEventArgs> AddPersonalLocationForCurrentUserCompleted;

        public void DeletePersonalLocationForCurrentUserAsync(int personalLocationId)
        {
            if (this.DeletePersonalLocationForCurrentUserCompleted != null)
            {
                this.DeletePersonalLocationForCurrentUserCompleted(null, new AsyncCompletedEventArgs(null, false, null));
            }
        }

        public event EventHandler<AsyncCompletedEventArgs> DeletePersonalLocationForCurrentUserCompleted;

        public void GetPersonalLocationForCurrentUserAsync(int ID)
        {
            if (this.GetPersonalLocationForCurrentUserCompleted != null)
            {
                this.GetPersonalLocationForCurrentUserCompleted(null, new GetPersonalLocationForCurrentUserCompletedEventArgs(new object[] { GetPersonalLocationResult }, null, false, null));
            }
        }

        public event EventHandler<GetPersonalLocationForCurrentUserCompletedEventArgs> GetPersonalLocationForCurrentUserCompleted;

        public void GetPersonalLocationsForCurrentUserAsync()
        {
            if (this.GetPersonalLocationsForCurrentUserCompleted != null)
            {
                this.GetPersonalLocationsForCurrentUserCompleted(null, new GetPersonalLocationsForCurrentUserCompletedEventArgs(new object[] { GetPersonalLocationsResult }, null, false, null));
            }
        }

        public event EventHandler<GetPersonalLocationsForCurrentUserCompletedEventArgs> GetPersonalLocationsForCurrentUserCompleted;

        public IAsyncResult BeginGetPersonalLocationsForCurrentUser(AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public System.Collections.ObjectModel.ObservableCollection<PersonalLocation> EndGetPersonalLocationsForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginGetPersonalLocationForCurrentUser(int ID, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public PersonalLocation EndGetPersonalLocationForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginAddPersonalLocationForCurrentUser(string description, double latitude, double longitude, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndAddPersonalLocationForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginDeletePersonalLocationForCurrentUser(int personalLocationId, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndDeletePersonalLocationForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }


        public void SearchByAddressAsync(string streetAddress, string country, string province, string city)
        {
            throw new NotImplementedException();
        }

        public event EventHandler<SearchByAddressCompletedEventArgs> SearchByAddressCompleted;

        public void SearchByPostalCodeAsync(string postalCode, string country)
        {
            throw new NotImplementedException();
        }

        public event EventHandler<SearchByPostalCodeCompletedEventArgs> SearchByPostalCodeCompleted;


        public IAsyncResult BeginSearchByPostalCode(string postalCode, string country, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public Location EndSearchByPostalCode(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginSearchByAddress(string streetAddress, string country, string province, string city, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public Location EndSearchByAddress(IAsyncResult result)
        {
            throw new NotImplementedException();
        }
    }
}
